package com.core.common;

import com.core.exception.ParameterException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class HandlerException {

    private static final Logger log = LoggerFactory.getLogger(HandlerException.class);


    @ExceptionHandler(ParameterException.class)
    @ResponseBody
    public ServerResponse errorParamException(Exception ex){
        log.error("出现了系统异常{}",ex.getStackTrace());
        log.error("详细错误信息如下",ex);
        return ServerResponse.fail(ex);
    }
}
